import request from '@/utils/request'
import qs from 'qs'

/**
 * 获取列表
 * @param limit
 * @param offset
 */
export function page(limit, offset, sjcdwmc) {
  return request({
    url: '/system/tableTwo/getPage',
    method: 'post',
    data: qs.stringify({
      limit,
      offset,
      sjcdwmc
    })
  })
}

/**
 * 编辑或保存
 * @param id
 * @param name
 * @param imgJson
 * @param showState
 */
export function addOrEdit(id, tableOneId, cyrq, cyrqend, gzcs, dzr, dzrq, shr, sjdwptr, bdsyt, qy, fs, wd, xdsd,
                          fx, tq, bdsytImgJson, table1Json) {
  console.log(cyrq, cyrqend)

  return request({
    url: '/system/tableTwo/addOrEdit',
    method: 'post',
    data: qs.stringify({
      id,
      tableOneId,
      cyrq,
      cyrqend,
      gzcs,
      dzr,
      dzrq,
      shr,
      sjdwptr,
      bdsyt,
      qy, fs, wd, xdsd, fx, tq,
      bdsytImgJson,
      table1Json
    })
  })
}

/**
 * 删除
 * @param id
 */
export function del(id) {
  return request({
    url: '/system/tableTwo/del',
    method: 'post',
    data: qs.stringify({
      id
    })
  })
}

export function getInfo(id) {
  return request({
    url: '/system/tableTwo/getInfo',
    method: 'post',
    data: qs.stringify({
      id
    })
  })
}
